package com.ruoyi.business.appuser.controller;


import com.ruoyi.business.appuser.service.RobotService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/controlRobot")
public class RobotController {

    @Autowired
    private RobotService robotService;

        @GetMapping("/forward")
    public AjaxResult forward(){

        return robotService.forward();
    }

    @GetMapping("/backward")
    public AjaxResult backward(){

        return robotService.backward();
    }

    @GetMapping("/leftward")
    public AjaxResult leftward(){

        return robotService.leftward();
    }


    @GetMapping("/rightward")
    public AjaxResult rightward(){

        return robotService.rightward();
    }


    @PostMapping("/receiveImage")
    public String receiveImage(@RequestBody String imageBase64) {
        // 在这里处理接收到的图像数据，例如保存到文件或进行其他操作
        System.out.println("Received image data: " + imageBase64);

        return "Image received successfully.";
    }
}
